#include "MusicCollection.h"
#include "IVIsitor.h"
#include "DurationCounter.h"

void MusicCollection::Add (MusicMedia * mm) {
	if ( mm == 0 ) throw std::exception("null pointer in MusicCollection::Add");
	mMedia.push_back(mm);
}

void MusicCollection::Accept (IVisitor * visitor) {
	if ( visitor == 0 ) throw std::exception("null pointer in MusicCollection::Accept");
	visitor->Visit(this);
	for (TMediaConstIterator it = mMedia.begin(); it != mMedia.end(); ++it) {
		(*it)->Accept(visitor);
	}
}

TMedia const * MusicCollection::getMedia() const {
	return &mMedia;
}